//	--------------------------------------------------------------------
//	Copyright(C) 2006,2007 Zhao Yukun. All rights reserved.
//	This file is a part of the Xeres system.
//	Xeres 2007
//	Contact : xeres.engine@gmail.com
//	$(reservedInfo)
//	$(reservedDeclaration)
//	--------------------------------------------------------------------
///	@file	<IEvent.h>
///	@path	~/src/engine/runtime/
///	@date	2007/11/07
///	@desc	Event interface.

#pragma once

#include "xeres.h"

#include "lib/utilities/callback.h"

#include "object/IObject.h"

namespace xeres {

	/*!
		\class	IEvent
		\brief	Event interface.
	*/
	class IEvent : public IObject
	{
	public:

		/// \ctor
		IEvent( void );

		/// \dtor
		virtual ~IEvent( void );

		DECL_IOBJECT_INTERFACE( IEvent , IObject );

	public:

	//@ interface

		/*!
			\brief		Active event.
		*/
		virtual void Active( void * eventParam );

		/*!
			\brief		Called when the event is not handled.
		*/
		virtual void OnUnhandled( void * eventParam ) = 0;


	private:

		friend class EventCenter;

		/*!
			\brief		Called when event is register to event center.
		*/
		void OnRegister( function<void(void*)> active_callback );

	//@ data
		function<void(void*)>	m_callback;
	};

} // namespace xeres
